package model;

import interfaces.IdAutoIncrement;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Hospedagem implements Serializable, IdAutoIncrement {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int id;
	private Hospede hospede;
	private Hotel hotel;
	private int quarto;
	private Calendar dataInicio, dataFim;
	private boolean reserva = false;
	private boolean quitada = false;

	public Hospede getHospede() {
		return hospede;
	}

	public void setHospede(Hospede hospede) {
		this.hospede = hospede;
	}

	public Hotel getHotel() {
		return hotel;
	}

	public void setHotel(Hotel hotel) {
		this.hotel = hotel;
	}

	public int getQuarto() {
		return quarto;
	}

	public void setQuarto(int quarto) {
		this.quarto = quarto;
	}

	public Calendar getDataInicio() {
		return dataInicio;
	}

	public void setDataInicio(Calendar dataInicio) {
		this.dataInicio = dataInicio;
	}

	public Calendar getDataFim() {
		return dataFim;
	}

	public void setDataFim(Calendar dataFim) {
		this.dataFim = dataFim;
	}
	
	public boolean isReserva() {
		return reserva;
	}
	
	public void setReserva(boolean reserva) {
		this.reserva = reserva;
	}

	@Override
	public void setId(int id) {
		this.id = id;
	}

	@Override
	public int getId() {
		return this.id;
	}

	public boolean isQuitada() {
		return quitada;
	}

	public void setQuitada(boolean quitada) {
		this.quitada = quitada;
	}

	@Override
	public String toString() {
		SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
		String retorno = "fail";
		try {
			retorno = "Hospedagem [id=" + id + ", hospede=" + hospede.getId() + ", hotel="
				+ hotel.getId() + ", quarto=" + quarto + ", dataInicio=" + f.format(dataInicio.getTime())
				+ ", dataFim=" + f.format(dataFim.getTime()) + ", reserva=" + reserva
				+ ", quitada=" + quitada + "]";
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return retorno;
	}

}
